<?php

// no direct access
defined('_JEXEC') or die;

$user =  &JFactory::getUser();
$lang = &JFactory::getLanguage();
$com_layout = JRequest::getVar('layout');
$components = JRequest::getVar('option');

if($lang->getTag() == 'vi-VN')
	
	$style = 'login_'.$lang->getTag();
else 
	$style = 'login_'.$lang->getTag();

if($user->id == 0): ?>
	<li class="login <?php echo $style; ?>" id="login"><a data-toggle="modal" data-target="#loginModal" href="javascript:void(null)" ><?php echo JText::_('WMC_TOP_MENU_LOGIN')?></a></li>
	<li class="space disabled" id="space"><a href="#">Space</a></li>
	<li class="signUp" id="signUp"><a data-toggle="modal" data-target="#signupModal" href="#"><?php echo JText::_('WMC_TOP_MENU_SIGNUP')?></a></li>
<?php else: ?>
	
	<li class="cart-detail" style="display: none;">
	    <a href="<?php echo JRoute::_('index.php?option=com_promotions&layout=shoppingcart&view=redemptions&Itemid=112'); ?>"><i class="fa fa-shopping-cart"></i></a>
	</li>
	<li>
		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i></a>
		<ul class="dropdown-menu right-menu" role="menu">
			<?php if($user->id != 0): ?>
			<li class="menuheader">
				<i class="fa fa-caret-square-o-down"></i><?php echo JText::_('WRD_LEFT_MENU_MYACCOUNT') ?>
			</li>
			<li class="menuitem">
				<a class="l_<?php echo JFilterOutput::stringURLSafe('MY ACCOUNT'); ?>" 
					href="<?php echo JRoute::_('index.php?option=com_wrd&view=profile&layout=default&id=1:'.JFilterOutput::stringURLSafe('MY ACCOUNT').'&Itemid=170'); ?>">
					<i class="fa fa-caret-right"></i><?php echo JText::_('WRD_LEFT_MENU_MYACCOUNT') ?></a>
			</li>
			<li class="menuitem">
				<a class="l_<?php echo JFilterOutput::stringURLSafe('MY POINTS'); ?>" 
					href="<?php  echo JRoute::_('index.php?option=com_wrd&view=profile&layout=myaccount&id=0:'.JFilterOutput::stringURLSafe('MY POINTS').'&Itemid=119'); ?>">
					<i class="fa fa-caret-right"></i><?php echo JText::_('WRD_LEFT_MENU_MYPOINT') ?></a>
			</li>
			<li class="menuitem">
				<a class="l_<?php echo JFilterOutput::stringURLSafe('Change Password'); ?>" 
					href="<?php  echo JRoute::_('index.php?option=com_wrd&view=profile&layout=reset&id=0:'.JFilterOutput::stringURLSafe('CHANGE PASSWORD').'&Itemid=119'); ?>">
					<i class="fa fa-caret-right"></i><?php echo JText::_('WRD_LEFT_CHANGE_PASSWORD') ?></a>		
			</li>
			<?php endif; ?>
			
			<li class="menuheader">
					<i class="fa fa-caret-square-o-down"></i><?php echo JText::_('WRD_LEFT_MENU_RESOURCES') ?>
			</li>
			<li class="menuitem">
				<a class="l_<?php echo JFilterOutput::stringURLSafe('PROMOTIONS'); ?>" 
					href="<?php echo JRoute::_('index.php?option=com_content&view=category&layout=blog&id=43:'.JFilterOutput::stringURLSafe('PROMOTIONS').'&Itemid=184') ?>">
					<i class="fa fa-caret-right"></i><?php echo JText::_('WRD_LEFT_MENU_PROMOTIONS') ?></a>
			</li>
			<li class="menuitem">
				<a class="l_<?php echo JFilterOutput::stringURLSafe('NEWS'); ?>" 
					href="<?php echo JRoute::_('index.php?option=com_content&view=category&layout=blog&id=44:'.JFilterOutput::stringURLSafe('NEWS').'&Itemid=220') ?>">
					<i class="fa fa-caret-right"></i><?php echo JText::_('WRD_LEFT_MENU_NEWS') ?></a>
			</li>
			<li class="menuitem">
				<a class="l_<?php echo JFilterOutput::stringURLSafe('EVENTS'); ?>" 
					href="<?php echo JRoute::_('index.php?option=com_content&view=category&layout=blog&id=12:'.JFilterOutput::stringURLSafe('EVENTS').'&Itemid=181') ?>">
					<i class="fa fa-caret-right"></i><?php echo JText::_('WRD_LEFT_MENU_EVENTS') ?></a>
			</li>
			<li class="menuheader">
				<i class="fa fa-caret-square-o-down"></i><?php echo JText::_('WRD_LEFT_MENU_MY_GIFT_REDEMPTION') ?>
			</li>
			
			<?php foreach($categories as $item): ?>
				<li class="menuitem">
					<a class="l_<?php echo JFilterOutput::stringURLSafe($item->title); ?>" 
						href="<?php echo JRoute::_('index.php?option=com_promotions&view=redemptions&id='.$item->id.':'.JFilterOutput::stringURLSafe($item->title)); ?>">
						<i class="fa fa-caret-right"></i><?php echo JText::_(WrdHelper::stringURLSafeAliasLang('WRD_LEFT_MENU_'.$item->title)); ?>
					</a>
				</li>
			<?php endforeach; ?>
	
			<?php if($user->id != 0): ?>
			    
			<li class="menuitem">
					<a class="l_recommend" 
					href="<?php echo JRoute::_('index.php?option=com_promotions&view=redemptions&id=recommend'); ?>">
						<i class="fa fa-caret-right"></i><?php echo JText::_('WRD_LEFT_MENU_RECOMMENDATION_FOR_YOU') ?>
					</a>
			</li>
			<?php endif; ?>
			
			
		</ul>
	</li>
	<li class="logged_in">
        <a href="<?php echo JRoute::_('index.php?option=com_wrd&view=profile&layout=myaccount&id=0:my-points&Itemid=119'); ?>">
            <i class="fa fa-trophy"></i>
        </a>
    </li>
	<li class="logged_in">
        <a href="<?php echo JRoute::_('index.php?option=com_wrd&task=profile.logout'); ?>">
            <i class="fa fa-sign-out"></i>
        </a>
    </li>
<?php endif; ?>